package com.fancy.learncenter.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.fancy.learncenter.activity.H5Activity;
import com.fancy.learncenter.activity.NewsDetailActivity;
import com.fancy.learncenter.activity.VideoDetailActivity;
import com.fancy.learncenter.adapter.base.CommonRecycleViewAdapter;
import com.fancy.learncenter.adapter.base.CustomViewHold;
import com.fancy.learncenter.bean.TopNewsDataBean;
import com.fancy.learncenter.utils.LogUtil;
import com.superservice.lya.R;

import java.util.ArrayList;

/**
 * Created by hyy on 2018/2/24.
 * Explain activity as
 */

public class MaterialAdapter extends CommonRecycleViewAdapter<TopNewsDataBean> {
    public MaterialAdapter(Context mContext, ArrayList<TopNewsDataBean> itemDatas) {
        super(mContext, R.layout.fragment_material_item, itemDatas);
    }

    @Override
    public void bindView(CustomViewHold customViewHold, final TopNewsDataBean item, int position) {
        SimpleDraweeView simpleDraweeView = customViewHold.getView(R.id.simpleDraweeView);
        simpleDraweeView.setImageURI(item.getImgsrc());

        TextView title = customViewHold.getView(R.id.title);
        title.setText(item.getTitle());

        TextView view_num = customViewHold.getView(R.id.num);
        view_num.setText(item.getAuthor());

        TextView time = customViewHold.getView(R.id.time);
        time.setText(item.getAdd_time());


        customViewHold.getRoorView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(mContext, NewsDetailActivity.class);
                intent.putExtra("dataId", item.getId());

                mContext.startActivity(intent);

            }
        });
    }
}
